package com.demo.bus_management.service.Impl;
import com.demo.bus_management.entity.BusLine;
import com.demo.bus_management.mapper.BusLineMapper;
import com.demo.bus_management.service.BusLineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BusLineServiceImpl implements BusLineService {

    @Autowired
    private BusLineMapper busLineMapper;

    @Override
    public List<BusLine> getAllBusLines() {
        return busLineMapper.selectList(null);
    }

    @Override
    public BusLine getBusLineById(Long id) {
        return busLineMapper.selectById(id);
    }

    @Override
    public List<BusLine> getBusLineByName(String line_name) {
        return busLineMapper.selectByName(line_name);
    }
    @Override
    public List<BusLine> getBusLineByNumber(String line_number) {
        return busLineMapper.selectByNumber(line_number);
    }

    @Override
    public void addBusLine(BusLine busLine) {
        busLineMapper.insert(busLine);
    }

    @Override
    public void updateBusLine(BusLine busLine) {
        busLineMapper.updateById(busLine);
    }

    @Override
    public void deleteBusLine(Long id) {
        busLineMapper.deleteById(id);
    }
}
